<template>
	<view>
		<view class="artItem posRelative mb15 justify-between align-center" v-for="(i,n) in datas" :key="n" @click="toMain(i)">

			<image :src="$domain.api +i.img_url" mode=""></image>
			<view class="right">
				<view class=" clamp2 name">
					{{i.title}}
				</view>
				<view class="align-center clamp1" style="margin: 16rpx 0 14rpx 0;">
				
					{{i.create_time}}
				</view>
				
				<view class="type " @click="getCoupon(i)">
					领取
				</view>
			</view>


		</view>

		<view class="" v-if="datas.length==0">
			<uv-empty ></uv-empty>
		</view>

	</view>
</template>

<script>
	export default {
		props: {
			datas: {
				type: Array,
				default: []
			}
		},
		data() {
			return {


			};
		},
		onLoad() {

		},
		onShow() {

		},
		methods: {
			formateTime(data) {
				return this.$utils.formatDateTime(data)
			},

			submitpz(id) {
				uni.navigateTo({
					url: '/pages/pay/index?id=' + id
				})
			},
			async getCoupon(item) {

				this.$api.getCoupon({
					coupon_id: item.id,
					user_id: this.user_id
				}).then(res => {
					console.log(res)

					if (res.code == 200) {
						uni.showToast({
							title: '领取成功'
						})
					}
				})

			},
			toMain(i){
				uni.navigateTo({
					url:'/pages/reportMain/index?id='+i.id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.artItem {

		
		margin-bottom: 58rpx;
		font-size: 24rpx;
		color: #666666;
		image {
			width: 240rpx;
			height: 180rpx;
			margin-right: 20rpx;
			flex-shrink: 0;
		}
		
		.name {
			font-weight: 500;
			font-size: 30rpx;
			color: #3D3D3D ;
		}

		.right {
			width: 422rpx;
			image {
				width: 28rpx;
				margin: 0 4rpx 0 0;
			}
		}
	}

	.type {
		width: 102rpx;
		height: 32rpx;
		background: rgba(255,2,50,0.8);
		border-radius: 0rpx 30rpx 30rpx 0rpx;
		font-size: 20rpx;
		position: absolute;
		color: #fff;
		text-align: center;
		letter-spacing: 4rpx;
		line-height: 32rpx;
		position: absolute;
		left: 0;
		top: 0;
	}
</style>